package com.yystar.user.operator.domain;

import com.yystar.user.operator.web.AuthenticationInterceptor;

public enum OperatorPolicy {

	// ----------------------------------------------------------------------------------- Manifest Constants
	
	GENERAL(0),
	BP_SPORT_MANAGEMENT(130),
	BP_LEAGUE_MANAGEMENT(131),
	BP_EVENT_MANAGEMENT(132),
	LOGIN_BP(133),
	BP_EVENT_TRADING(134),
	BP_EVENT_SCHEDULE(135),
	BP_EVENT_OUTCOME(136),
	BP_LOAD_EVENT_SETTING(137),
	
	BP_EVENT_BET_MONITOR(138),
	BP_EVENT_LOG(139),
	BP_EVENT_MARKET_LOG(140),
	
	BP_SYSTEM_OPERATION(141),
	BP_MARKET_TEMPLATE_MANAGEMENT(142),
	BP_MTS_PROFILE(143),
	BP_TRADING_PROFILE(144),
	BP_SETTLEMENT_PROFILE(145),
	BP_TEAM_MANAGEMENT(146),
	BP_DEFAULT_SMA_SETTING(147),
	BP_DEFAULT_RETAIL_SETTING(148),
	BP_ALL_BET(149),
	BP_USER_MANAGER_LOG(150),
	BP_PROXY_FILTER_LEAGUE(151),
	BP_PLAYER_MANAGEMENT(152);
	
	private final int value;
	
	private OperatorPolicy(int value){
		this.value = value;
	}
	

	public int getValue() {
		return value;
	}


	public static boolean canAccess(OperatorPolicy operatorPolicy) {
		return canAccess(operatorPolicy, true);
	}

	public static boolean canAccess(OperatorPolicy operatorPolicy, boolean defaultValue) {
		Operator operator = AuthenticationInterceptor.getOperator();
		if (operator == null)
			return defaultValue;

		return operator.canAccess(operatorPolicy.value);
	}
}
